package lelouet.sh3d.plugins.sweetDatacenter.model;

import gridlib.api.GridElement;

import com.eteks.sweethome3d.model.HomePieceOfFurniture;
import com.eteks.sweethome3d.model.PieceOfFurniture;

/**
 * graphical elements are {@link HomePieceOfFurniture} that are linked to a
 * {@link GridElement}<br />
 * Any modification done to one representation should be reported on the other,
 * such as (re)moving the element, inserting it in one other element, renaming,
 * etc.<br />
 * There are basically two kinds of attributes :
 * <ul>
 * <li>not often modified, and so modifications are directly propagated from one
 * model to another (actually, only one model owns it, the other redirect get
 * and set calls)</li>
 * <li>often modified, to enhance performances the modification is not
 * propagated until required (save, value asked)</li>
 * </ul>
 * Override {@link #propagate()} to force synchronization (don't forget to call
 * super.propagate() )
 */
public abstract class GElement extends HomePieceOfFurniture {

	private static final long serialVersionUID = 1L;

	/** the bridge that knows every elements of both models */
	protected GElementFactory bridge = null;

	protected GElement(GElementFactory bridge, PieceOfFurniture model) {
		super(model);
		this.bridge = bridge;
	}

	/**
	 * propagates the {@link GElement}'s model state on the {@link GridElement}
	 * 's model.
	 */
	public void propagate() {

	}

	/**
	 * removes any reference of this in its parents, in the {@link GridLib}
	 * model
	 */
	public abstract void removeGridReferences();

	/** to call when the graphical part has deleted this from its view. */
	public abstract void graphicalDelete();

}
